#!/usr/bin/env bash

cnt=0
> startup.txt

while true
do
	vim --clean --not-a-term --startuptime startup.txt -c q
	cnt=$((cnt+1))

	if [[ "$cnt" -gt "$1" ]];then
		break
	fi
done

filetype=$(awk '/filetype.vim/ {sum += $2} END {print sum}' startup.txt)
total=$(awk '/editing files in windows/ {sum += $1} END {print sum}' startup.txt)
printf "%.1f %.1f %.3f\n" $filetype $total $(echo "$filetype/$total" | bc -l)
